package com.vn.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="PaymentInstallment")
public class PaymentInstallment {

	public PaymentInstallment() {
	}

	public PaymentInstallment(PaymentInstallmentPK paymentInstallmentPK,
			PurchaseContract purchaseContract, Date deadline,
			double paymentAmount, short status, String log) {
		super();
		this.paymentInstallmentPK = paymentInstallmentPK;
		this.purchaseContract = purchaseContract;
		this.deadline = deadline;
		this.paymentAmount = paymentAmount;
		this.status = status;
		this.log = log;
	}

	@EmbeddedId
    protected PaymentInstallmentPK paymentInstallmentPK;
	
	@JoinColumn(name="ContractID",referencedColumnName="IDContract", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
	private PurchaseContract purchaseContract;
	
	@Column(name="Deadline")
	private Date deadline;
	
	@Column(name="PaymentAmount")
	private double paymentAmount;
	
	@Column(name="Status")
	private short status=0;
	
	@Column(name="Log")
	private String log;

	public PaymentInstallmentPK getPaymentInstallmentPK() {
		return paymentInstallmentPK;
	}

	public void setPaymentInstallmentPK(PaymentInstallmentPK paymentInstallmentPK) {
		this.paymentInstallmentPK = paymentInstallmentPK;
	}

	public PurchaseContract getPurchaseContract() {
		return purchaseContract;
	}

	public void setPurchaseContract(PurchaseContract purchaseContract) {
		this.purchaseContract = purchaseContract;
	}

	public Date getDeadline() {
		return deadline;
	}

	public void setDeadline(Date deadline) {
		this.deadline = deadline;
	}

	public double getPaymentAmount() {
		return paymentAmount;
	}

	public void setPaymentAmount(double paymentAmount) {
		this.paymentAmount = paymentAmount;
	}

	public short getStatus() {
		return status;
	}

	public void setStatus(short status) {
		this.status = status;
	}

	public String getLog() {
		return log;
	}

	public void setLog(String log) {
		this.log = log;
	}
	
	
}
